function convertDateTime (dateObject, show) {
  let res = ''
  if (dateObject) {
    let year = dateObject.getFullYear()
    let month = dateObject.getMonth() + 1
    let date = dateObject.getDate()
    let hour = dateObject.getHours()
    let minute = dateObject.getMinutes()
    let second = dateObject.getSeconds()
    res = show
      ? `${year}-${month}-${date} ${hour}:${minute}:${second}` : `${year}-${month}-${date}T${hour}:${minute}:${second}`
  }
  return res
}

function convertDateTimeToTime (dateObject, show) {
  let res = ''
  if (dateObject) {
    let hour = dateObject.getHours()
    let minute = dateObject.getMinutes()
    let second = dateObject.getSeconds()
    res = show
      ? `${hour}:${minute}:${second}` : `${hour}:${minute}:${second}`
  }
  return res
}

export default {
  convertDateTime,
  convertDateTimeToTime
}
